<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>块级框1</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .div1 {
            padding: 10px;
            border: 3px solid black;
            /* 不浮动没有包裹性 */
        }

        .div2 {
            float: left;
            padding: 10px;
            border: 3px solid red;
            /* height: 100px;
            width: 100px; 
            父元素浮动宽高困不住子元素
            不加宽高 用包裹性可以包住子元素*/
        }
    </style>
</head>

<body>
    <div class="div1">
        <img src="djs.jpg" height=100px; width=100px>
    </div>
    <div class="div2">
        <img src="djs.jpg">
    </div>
</body>

</html>